package service

import (
	"monthly-test/global"
	"monthly-test/internal/model/dao"
)

func List(page, pageSize int) ([]dao.Video, error) {
	var video []dao.Video
	err := global.DB.Order("likes desc").Order("looks desc").Offset((page - 1) * pageSize).Limit(pageSize).Find(&video).Error
	if err != nil {
		return nil, err
	}
	return video, nil
}
